<?php
registerTable("user_verify", new table_user_verify());

class table_user_verify extends Database
{

    public function __construct()
    {
        parent::__construct("user_verify");
    }

    public function isPhoneVerified($uid)
    {
        return parent::fetch_assoc("`uid`='$uid'", "isphoneverifyed")["isphoneverifyed"];
    }

    public function isMailVerified($uid)
    {
        return parent::fetch_assoc("`uid`='$uid'", "ismailverifyed")["ismailverifyed"];
    }

    public function fetch_mail_state_by_uid($uid)
    {
        return parent::fetch_assoc("`uid`='$uid'", "ismailverifyed,mailverifycode");
    }

    public function fetch_phone_state_by_uid($uid)
    {
        return parent::fetch_assoc("`uid`='$uid'", "isphoneverifyed,phoneverifycode");
    }

    public function updateMailVerifyState($uid, $state, $code = "")
    {
        return parent::update(array(
            "ismailverifyed" => $state,
            "mailverifycode" => $code
        ), "`uid`='$uid'");
    }

    public function updatePhoneVerifyState($uid, $state, $code = "")
    {
        return parent::update(array(
            "isphoneverifyed" => $state,
            "phoneverifycode " => $code
        ), "`uid`='$uid'");
    }
}
?>